<style>.upload-item{position: relative;}.delitem{width: 30px;line-height: 15px;text-align: center;font-size: 12px;position: absolute;top: 0;right: 0;color: #fff;background-color: #f32323;padding: 2px;border-radius: 3px;z-index: 100;}</style>
<div>
    <div>共<?php echo $count;?>个图片</div>
    <div class="upload-wrap flex-wrap flex-row flex-justify-start flex-align-center">
        <?php foreach ($originval as $k=>$v):?>
            <?php if (!empty($v)):?>
            <div class="upload-item">
                <div class="preview">
                    <img src="<?php echo $v;?>" style="height:100px">
                </div>
                <div class="delitem" data-index="<?php echo $k;?>">删除</div>
            </div>
            <?php endif;?>
        <?php endforeach;?>
    </div>
    <input class="fileupload_<?php echo $ckey;?>" type="file" name="<?php echo $ckey;?>[]" multiple="multiple" style="border: none;width: auto;max-width: 150px;" req="<?php echo $request;?>">
    <input class="delimg" name="del" type="text" value="" style="display: none;">
</div>
<script type="text/javascript">
    $(document).on('click','.delitem',function () {
        var i =$(this).attr('data-index');
        var delinput = $('input[name="del"]');
        var del = delinput.val();
        del += del===""?i:'|'+i;
        delinput.val(del);
        $(this).parent().remove();
    });
    $('#addimage').on('click',function () {
        var html = '<div class="upload-item">' +
            '<div class="preview"></div><div class="delitem">删除</div>'+
            '<input class="fileupload_<?php echo $ckey;?>" type="file" name="<?php echo $ckey;?>[]" style="border: none;width: auto;max-width:150px;" req="<?php echo $request;?>"></div>';
        $(this).parent().find('.upload-wrap').append(html);
    });
</script>